package demo.inoutput;

import java.awt.image.BufferedImage;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.Reader;

public class ReaderNWritter {
	public static void main(String[] args)  throws IOException{
		File inputFile = new File("C:/Users/TayDo/Demo/putty.exe");
		 File outputFile = new File("C:/Users/TayDo/Demo/asdcopy.exe");
		 
		 
//		 BufferedReader in = new BufferedReader(new FileReader(inputFile));
//		 BufferedWriter out = new BufferedWriter(new FileWriter(outputFile));
//		 String line;
//		 while ((line = in.readLine()) != null){
//		 out.write(line);
//		 out.newLine();
//		 }
//		 in.close();
//		 out.close();

		 
		 
		 
		 FileReader in = new FileReader(inputFile);
		 FileWriter out = new FileWriter(outputFile);
		 char[] b = new char[255];
		  int c;
		  while ((c = in.read(b)) != -1)
			  out.write(b, 0, c);
		  
		  int a = 10000;
		  out.write(a);
		  in.close();
		  out.flush();
		  out.close();
		  
//		  FileInputStream fis = new FileInputStream(inputFile);
//		  FileOutputStream fos = new FileOutputStream(outputFile);
//		  DataInputStream dis = new DataInputStream(fis);
//		  DataOutputStream dos = new DataOutputStream(fos);
//		  byte[] d = new byte[255];
//		  int l;
//		  while ((l = dis.read(d)) > 0) {
//			  dos.write(d, 0, l);
//		  }
//		  dos.flush();
//		  dis.close();
//		  dos.close();
		  
	}
}
